home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / VGAKIT50.ARJ / EXAMPLE.C < prev    next >
Text File  |  1992-06-25  |  1KB  |  72 lines

  1. /*
  2.     VGAKIT Version 5.0
  3.  
  4.     Copyright 1988,89,90,91,92 John Bridges
  5.     Free for use in commercial, shareware or freeware applications
  6.  
  7.     EXAMPLE.C
  8. */
  9.  
  10.  
  11. extern int maxx,maxy;
  12.  
  13. main(argc,argv)
  14. int argc;
  15. char **argv;
  16. {
  17.     unsigned char palbuf[256][3];
  18.     unsigned long x2;
  19.     int svga;
  20.     unsigned int color;
  21.     unsigned int x,y;
  22.  
  23.     for(x=0;x<256;x++)
  24.     {
  25.         y=x&63;
  26.         if(x&64) y=63-y;
  27.         palbuf[x][0]=y;
  28.         palbuf[x][1]=y*y/63;
  29.         y=(x>>1)&63;
  30.         if(x&128) y=63-y;
  31.         palbuf[x][2]=y;
  32.     }
  33.     svga=whichvga();    
  34.     if(svga)
  35.     {
  36.         svgamode();
  37.     }
  38.     else
  39.     {
  40.         mode13x();
  41.     }
  42.     setmany(palbuf,0,256);
  43.     for(x=0;x<maxx/2;x++)
  44.     {
  45.         for(y=0;y<maxy/2;y++)
  46.         {
  47.             x2=(x+1)*(maxx-x);
  48.             color=((x2*x2)/((y+1)*(long)(maxy-y))/113)&0xff;
  49.             if(svga)
  50.             {
  51.                 point(x,y,color);
  52.                 point((maxx-1)-x,y,color);
  53.                 point(x,(maxy-1)-y,color);
  54.                 point((maxx-1)-x,(maxy-1)-y,color);
  55.             }
  56.             else
  57.             {
  58.                 point13x(x,y,color);
  59.                 point13x((maxx-1)-x,y,color);
  60.                 point13x(x,(maxy-1)-y,color);
  61.                 point13x((maxx-1)-x,(maxy-1)-y,color);
  62.             }
  63.         }
  64.     }
  65.     getch();
  66.     txtmode();
  67. }
  68.  
  69.  
  70.  
  71.  
  72.